package com.example.practical_training_projects.service;

import com.example.practical_training_projects.entity.pc;
import com.example.practical_training_projects.entity.user;
import com.example.practical_training_projects.mapper.pcMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class pcServiceImpl implements pcService {

    private final pcMapper mapper;

    @Autowired
    public pcServiceImpl(pcMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public List<pc> getAllpc() {
        return mapper.getAllpc();
    }

    @Override
    public PageInfo<pc> findpcpage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<pc> lists=mapper.getAllpc();
        PageInfo<pc> pageInfo=new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public Integer insertPc(pc pc) {
        return mapper.insertPc(pc);
    }

    @Override
    public Integer deletePc(Integer pc_uid) {
        return mapper.deletePc(pc_uid);
    }

    @Override
    public Integer updatePc(pc pc) {
        return mapper.updatePc(pc);
    }

    @Override
    public List<pc> getpcBYName(String pc_name) {
        return mapper.getpcBYName(pc_name);
    }

    @Override
    public pc findPcid(Integer pc_uid) {
        return mapper.findPcid(pc_uid);
    }

    @Override
    public pc authenticatePc(String pcName, String password) {
        return mapper.authenticatePc(pcName, password);
    }

}
